﻿using System;
using System.Windows.Documents;
using RG.Common.WPF.Frames;

namespace RG.Common.WPF.Reporting
{
    [SupportDataBinding]
    public abstract class BaseReport : ReportPrintFrameVM, IReport
    {
        protected abstract XpsReport ReportTemplate { get; }

        public XpsReport report
        {
            get { return ReportTemplate; }
        }

        public FixedDocumentSequence CreateReport()
        {
            string packUriName = String.Format("pack://temp.{0}.{1}.xps",
                                               System.Reflection.MethodBase.GetCurrentMethod().DeclaringType,
                                               DateTime.Now.Ticks);
            ReportDoc = this.WriteToPackage(packUriName);
            return ReportDoc;
        }
    }
}